global source,destination,uselevel,counter,temp1,temp2,temp3
put short name of this stack into temp3
Put "Which SYLK file do you wish to import?" into msg
show msg
put filename("TEXT") into source
if source is "cancel" then
hide msg
exitmouseup
end if
if source is empty then
hide msg
exit mouseUp
end if
open file source
put "Where do you want the data put?" into msg
show msg
put filename("STAK") into destination
if destination is "cancel" then
hide msg
exitmouseup
end if
if destination is empty then
hide msg
exit mouseUp
end if
put "Please wait while the file is imported..." into msg
set cursor to 4
set lockscreen to true
set lockmessages to true
go destination
go last card
put 1 into counter
repeat forever
repeat 100
read from file source until return
if it is empty then exit repeat
put it into line counter of temp1
get char 1 of line counter of temp1
if it is empty then exit repeat
if it is "c" then
get char 3 of line counter of temp1
if it is "y" then
put 1 into temp2
domenu "New Card"
repeat for the number of chars in line counter of temp1
get char 3 of line counter of temp1
if it is not "k" then
put empty into char 3 of line counter of temp1
else
put empty into char 3 of line counter of temp1
exit repeat
end if
end repeat
repeat for the number of chars in line counter of temp1
get char 3 of line counter of line counter of temp1
if it is quote then
put empty into char 3 of line counter of temp1
else
put it & " " into last char of field temp2
put empty into char 3 of line counter of temp1
end if
end repeat
end if
if it is "x" then
add 1 to temp2
repeat for the number of chars in line counter of temp1
get char 3 of line counter of temp1
if it is not "k" then
put empty into char 3 of line counter of temp1
else
put empty into char 3 of line counter of temp1
exit repeat
end if
end repeat
repeat for the number of chars in line counter of temp1
get char 3 of line counter of line counter of temp1
if it is quote then
put empty into char 3 of line counter of temp1
else
put it & " " into last char of field temp2
put empty into char 3 of line counter of temp1
end if
end repeat
end if
if it is "k" then
add 1 to temp2
repeat for the number of chars in line counter of temp1
get char 3 of line counter of temp1
if it is not "k" then
put empty into char 3 of line counter of temp1
else
put empty into char 3 of line counter of temp1
exit repeat
end if
end repeat
repeat for the number of chars in line counter of temp1
get char 3 of line counter of line counter of temp1
if it is quote then
put empty into char 3 of line counter of temp1
else
put it & " " into last char of field temp2
put empty into char 3 of line counter of temp1
end if
end repeat
end if
add 1 to counter
end if
if it is "e" then
go temp3
close file source
set lockscreen to false
beep 2
put "All done!" into msg
wait 5
hide msg
answer "Did any imported fields contain dates?" with "Yes" or "No"
if it is "Yes" then
answer "Convert to HyperCard format?" with "Yes" or "No"
repeat while it is "Yes"
ask "Which field needs to be converted?"
put it into temp2
answer "Short Date, Long Date or Abbreviated Date?" with "Abbr" or "Long" or "Short"
put it into temp1
put "Ok, I'm off to convert that field..." into msg
set lockscreen to true
set lockmessages to true
go destination
go first card
Answer "Convert entire stack?" with "Yes" or "No"
if it is "Yes" then
put the number of cards into counter
else
ask "How many cards?"
put it into counter
ask "Starting with which card?"
go card it
end if
repeat for counter
if temp1 is "Long" then
multiply field temp2 by 86400
convert field temp2 to long date
end if
if temp1 is "abbr" then
multiply field temp2 by 86400
convert field temp2 to abbr date
end if
if temp1 is "short" then
multiply field temp2 by 86400
convert field temp2 to short date
end if
go next
end repeat
go temp3
set lockscreen to false
set lockmessages to false
beep 2
put "All done!" into msg
wait 5
hide msg
answer "Any more fields to convert?" with "Yes" or "No"
end repeat
end if
exit mouseup
end if
end repeat
end repeat
end mouseup
-- part 20 (button)
-- low flags: 80
-- high flags: 8004
-- rect: left=312 top=50 right=73 bottom=342
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: OK
----- HyperTalk script -----
on mouseUp
hide card field 2
hide card button 22
end mouseUp
-- part 33 (button)
-- low flags: 00
-- high flags: 0003
-- rect: left=447 top=305 right=340 bottom=502
-- title width / last selected line: 0
-- icon id / first selected line: 14767 / 14767
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: about…
----- HyperTalk script -----
on mouseUp
visual dissolve to black
visual dissolve to white
visual dissolve to black
visual dissolve
go to card id 2462
end mouseUp
-- part 35 (button)
-- low flags: 00
-- high flags: C000
-- rect: left=426 top=12 right=74 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 31685 / 31685
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Help…
----- HyperTalk script -----
on mouseUp
set lockscreen to true
show card field 1
show card button 6
set lockscreen to false
end mouseUp
-- part 36 (field)
-- low flags: 81
-- high flags: 0007
-- rect: left=119 top=156 right=342 bottom=372
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Help
-- part 37 (button)
-- low flags: 80
-- high flags: 8003
-- rect: left=216 top=139 right=163 bottom=304
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Close Help…
----- HyperTalk script -----
on mouseUp
set lockscreen to true
hide card field 1
hide card button 6
set lockscreen to false
end mouseUp
-- part 40 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=157 top=97 right=133 bottom=302
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Convert Date
----- HyperTalk script -----
on mouseUp
global source,destination,uselevel,counter,temp1,temp2,temp3
put the short name of this stack into temp3
put "Which stack needs converting?" into msg
show msg
put filename("STAK") into destination
if destination is "cancel" then
hide msg
exitmouseup
end if
if destination is empty then
hide msg
exit mouseUp
end if
Put "Yes" into it
repeat while it is "Yes"
ask "Which field needs to be converted?"
put it into temp2
answer "Short Date, Long Date or Abbreviated Date?" with "Abbr" or "Long" or "Short"
put it into temp1
put "Ok, I'm off to convert that field..." into msg
set lockscreen to true
set lockmessages to true
go destination
go first card
Answer "Convert entire stack?" with "Yes" or "No"
if it is "Yes" then
put the number of cards into counter
else
ask "How many cards?"
put it into counter
ask "Starting with which card?"
go card it
end if
repeat for counter
if temp1 is "Long" then
multiply field temp2 by 86400
convert field temp2 to long date
end if
if temp1 is "abbr" then
multiply field temp2 by 86400
convert field temp2 to abbr date
end if
if temp1 is "short" then
multiply field temp2 by 86400
convert field temp2 to short date
end if
go next
end repeat
go temp3
set lockscreen to false
set lockmessages to false
beep 2
put "All done!" into msg
wait 5
hide msg
answer "Any more fields to convert?" with "Yes" or "No"
end repeat
end mouseup
-- part contents for card part 36
----- text -----
In order to use this stack to its fullest potential it will be neces-sary to do a couple of preliminary things.
1. Save a file as “SYLK” format.
2. Create a stack that has the same number of background fields as the “SYLK” file you are import-ing.
3. Push the “Import SYLK” button.
4. Follow the instructions and give it the information it needs and then sit back and wait. If it seems slow, that's because it is. The problem is not in the stack or scripts, but rather in HyperCard‚Ñ¢ itself.
5. Sit back and wait for it to finish.
6. Because of the way Microsoft products handle dates, it will be necessary to convert these imported dates to HyperCard‚Ñ¢ format. This is handled by the
“Import SYLK” button, and also by the “Convert Date” button. This is because you will have to know which field needs to be converted, and how many cards need to be converted, and the card/field numbers associated with the conversion. If you have to leave this stack to find this information after you finish importing, just hit the “Convert Date” button. Other-wise, if you already know this info, you can just do it at the end of the data importation.
*** Custom applications are available. If you are interested in a custom application, please contact me via the address on the next card. Above all, let me know if you are happy, or upset with this stack. Only then can I improve it.